Basic4GL v2, Copyright (C) 2003 Tom Mulgrew

Getting started

9-Nov-2003
Tom Mulgrew

For news and updates, visit http://www.basic4gl.net/

What is Basic4GL?

Welcome to Basic4GL! Basic4GL is a compiler and virtual machine that allows you to write and run programs written in the Basic4GL programming language. This language is based on the traditional BASIC language but with support for modern and relevant technologies, most importantly OpenGL.
Basic4GL is written for Microsoft Windows 98 and upwards (although ports to other platforms such as Linux and MacOS may come later).

I had two goals when I started writing Basic4GL:

  1. To make OpenGL easy.
    In essence OpenGL is quite straight forward to learn and use, but the amount of setup code can be daunting to first-timers and make it seem a lot more complicated than it actually is. Basic4GL automatically sets up everything for you, so you can start writing OpenGL code from line one.
  2. To make a free, safe and easy to learn programming language for people who are new to programming to experiment in, and perhaps discover that programming is not quite as arcane and mysterious as many people make out!
    Basic4GL is designed to be safe, so that programs never cause access violations or crash or hang the computer (note: while I can't guarantee all of this, in my experience Basic4GL has been extremely stable and reliable.) It is also based on the BASIC programming language (Beginners All-purpose Symbolic Instruction Code) which was designed to be a easy to use and easy to learn for beginners.
    I learned to program when I was 8 years old, by typing programs into a Commodore VIC-20 from instruction manuals and books. These programs were written in BASIC, and without that free introductory language I might never have become the professional programmer I am today. Today there seems to be a wide gap in this area and I hope that Basic4GL goes some way towards filling it.

In short, Basic4GL is a programming language with training wheels, but based on relevant modern technology.

If you're new to programming, or new to OpenGL, or if you just want a quick and easy environment for experimenting with OpenGL then Basic4GL is designed for you. 

Requirements

Windows 98 or more recent.
3D accellerated video card.
A decent system. Basically the faster the PC and video card, the more detailed and complex programs you can run at an acceptable speed.
The demo programs all run fine on a P2-350 with a NVidia TNT based graphics card.

Getting started

Run Basic4GL.exe. If all goes well, the Basic4GL editor will come up, empty. If Basic4GL can't setup OpenGL, you may need to select a different graphics mode and restart

Open an existing Basic4GL program:

  1. Click "Program" on the menu bar.
  2. Click "Open..." in the drop down menu.
  3. Double click the "Programs" folder.
  4. Double click a Basic4GL program, e.g. "CubePyramidDemo.gb"

Run the program by either:

  1. Selecting "Program|Run! / Stop!" from the main menu, OR
  2. Click the green "Go!" icon on the toolbar, OR
  3. Press F9 or F5

The program should run. Press the Escape key to halt it and return to the Basic4GL editor.

Basic4GL video modes

You can set the Basic4GL video modes by clicking "Basic4GL|Options...".
In the resulting dialog box you can specify how Basic4GL program output will be displayed.

The most significant choice is the "Fullscreen" checkbox.
In fullscreen mode, Basic4GL will switch your monitor to the resolution and colour depth you specify. The Basic4GL program will have control of the entire monitor screen until the program terminates, or you close it by pressing the Escape key.

When not in full screen, the Basic4GL output is displayed in another window.
The width and height that you specify are used as the size of the window, and will use the current colour depth of the desktop.

Choosing the right mode

The most compatible mode is:
Fullscreen
Width = 640
Height = 480
Colour Depth = 16 Bit

If that doesn't work for you, then Basic4GL may not be able to run on your computer.

Higher resolution modes look nicer, but require more hardware power to run fast, and older (or cheaper) video cards may not support them.
Likewise with 32 Bit Colour Depth.

You may need to experiment to find the optimal setting for your hardware.

Running programs

This is fairly simple.

First you put a program into Basic4GL, by either loading one or typing one in. (Select "Program|Open..." to load a program. The demonstration programs are in the "Programs" subfolder.)

Then you run the program by selecting "Program|Run! / Stop!" from the menu or by clicking the green "Go!" icon, or pressing F5 or F9 :-).

Program errors

If there's an error in the program, it won't run. Instead, Basic4GL will display the error on the status bar and place the cursor where the problem occurs.

You will need to correct the problem before Basic4GL can run the program.
This may involve obtaining the correct version of the program (if someone else wrote it), or correcting it yourself, or reloading the program (incase you might have accidentally typed something into the program.)

Where to now?